<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .bigbox {
            position: relative;
            margin-left: 50px;
        }

        .box {
            height: 100px;
            width: 100px;
            background-color: pink;
            padding: 10px;
            border: black 5px solid;
            position: absolute;
            left: 100px;
        }
    </style>
</head>

<body>
    <div class="bigbox">
        <div class="box">
        </div>
    </div>
    <script>
        //offsetWidth    offsetHeight自身加内边距加边框
        //clientHeight    clientWidth自身宽高或者高+内边距
        //offsetLeft    offsetTop 没有定位是相当于页面的偏移量有定位相当于父级单位的偏移量
        //clientLeft  clientTop 获取左和上边border
        // var getbox = document.querySelector(".box")
        // document.onclick = function () {
        //     console.log(getbox.offsetWidth)
        //     console.log(getbox.offsetHeight)
        //     console.log(getbox.clientHeight)
        //     console.log(getbox.clientWidth)
        //     console.log(getbox.offsetLeft)
        //     console.log(getbox.offsetTop)
        //     console.log(getbox.clientLeft)
        //     console.log(getbox.clientTop)
        // }
    </script>
</body>

</html>